package com.contract.sql;

import java.sql.Connection;

import java.sql.*;

import com.javabean.contract.javaBeanZhuce;

public class insertInfor {
	public void insert(javaBeanZhuce user) {
		
		 Connection conn=null;
		    Statement stml=null;
		   //ResultSet res=null;
		   String sql=null; 
		   sql="insert into classmate(name,youbian,qq,wechat,mobilephone,school,email,unit,address,hometel,unittel,position) values('"+user.getName()+"','"+user.getYoubian()+"','"+user.getQq()+"','"+user.getWechat()+"','"+user.getMobilephone()+"','"+user.getSchool()+"','"+user.getEmail()+"','"+user.getUnit()+"','"+user.getAddress()+"','"+user.getHometel()+"','"+user.getUnittel()+"','"+user.getPosition()+"')";
		   try{
				Class.forName("com.mysql.jdbc.Driver");
	   		   	conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/classcontra?charaterEncoding=utf-8","root","s1234560");
	   		     stml= conn.createStatement();
	   		   	stml.executeUpdate(sql);	
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
